/**
 * Created by gemini on 2017/4/19.
 */
myApp.factory('memberService',function ($http) {
   function login(mobile,password,result) {
       return $http({
           method:"post",
           url:"http://dev.bestgym.cn/api/v1/operator/operator/login",
           data:{
               mobile:mobile,
               password:password
           }
       }).success(function (data) {
           result(data)
       }).error(function (data) {
           alert("失败！")
       });
   }

   function memberList(company,page,rows,result) {
       return $http({
           method:"post",
           url:"http://dev.bestgym.cn/api/v1/member/member/member_list",
           data:{
               company_id:company,
               page:page,
               rows:rows
           }
       }).success(function (data) {
           result (data)
       }).error(function (data) {
           alert("失败！")
       });
   }

    function memberDetail(member_id,result) {
        return $http({
            method:"post",
            url:"http://dev.bestgym.cn/api/v1/member/member/member_detail",
            data:{
                member_id:member_id
            }
        }).success(function (data) {
            result (data)
        }).error(function (data) {
            alert("失败！")
        });
    }

   return {
       login:function (mobile,password,result) {
           return login(mobile,password,result)
       },
       memberList:function (company,page,rows,result) {
           return memberList(company,page,rows,result)
       },
       memberDetail:function (member_id,result) {
           return memberDetail(member_id,result)
       }
   }
});